
<template>
  <div class="main">
    <div><router-view></router-view></div>

    <!-- 顶部标题 -->
    <!-- <van-nav-bar title="设备" left-arrow  @click-left="onClickLeft"/> -->

    <!-- 下拉列表 -->
    <!-- <van-dropdown-menu>
      <van-dropdown-item v-model="value" :options="option" />
    </van-dropdown-menu> -->

    <!-- 搜索框 -->
    <!-- <van-search v-model="inpValue" 
        placeholder="请输入搜索关键词" 
        left-icon 
        @keydown.13="searchVal"
    />
    <van-icon name="search" class="searchIcon" @click="searchVal"/> -->

    <!-- 底部导航 -->
    <van-tabbar v-model="selected" active-color="#fe7e2e">
      <van-tabbar-item to="device" name="device">
        <img
          v-if="selected == 'device'"
          src="../../static/img/device-nav-active.png"
          slot="icon"
        />
        <img v-else src="../../static/img/device-nav-out.png" slot="icon" />
        设备
      </van-tabbar-item>

      <van-tabbar-item to="/sensor" name="sensor">
        <img
          v-if="selected == 'sensor'"
          src="../../static/img/device-sensor-active.png"
          slot="icon"
        />
        <img v-else src="../../static/img/device-sensor-out.png" slot="icon" />
        传感器
      </van-tabbar-item>

      <van-tabbar-item to="/hospital" name="hospital">
        <img
          v-if="selected == 'hospital'"
          src="../../static/img/hospital-nav-active.png"
          slot="icon"
        />
        <img v-else src="../../static/img/hospital-nav-out.png" slot="icon" />
        医院
      </van-tabbar-item>

      <van-tabbar-item to="/stat" name="stat">
        <img
          v-if="selected == 'stat'"
          src="../../static/img/hospital-nav-active.png"
          slot="icon"
        />
        <img v-else src="../../static/img/hospital-nav-out.png" slot="icon" />
        统计
      </van-tabbar-item>

      <van-tabbar-item to="/mime" name="user">
        <img
          v-if="selected == 'user'"
          src="../../static/img/hospital-nav-active.png"
          slot="icon"
        />
        <img v-else src="../../static/img/hospital-nav-out.png" slot="icon" />
        个人
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      // 底部导航
      selected: "device",
      // 搜索框
      inpValue:'',
      //  下拉框
      value: 0,
      option: [
        { text: "设备MEI", value: 0 },
        { text: "传感器编号", value: 1 },
        { text: "医院名称", value: 2 },
        { text: "医院渠道", value: 3 },
      ],
    };
  },
  methods: {
    onClickLeft() {
      console.log('1');
    },
    searchVal(){
      console.log(`查询 ${this.inpValue} 相关内容`);
    }
  },
};
</script>

<style>
/* 顶部返回箭头样式 */
i.van-icon.van-icon-arrow-left.van-nav-bar__arrow{
   color: #323233 ;
}
/* 下拉列表 */
/* div.van-dropdown-menu__bar {
  width: 110px;
  height: 30px;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-left: 5px;
} */
/* 搜索框 */
/* div.van-search{
  background-color: white;
  width: 250px;
  position: absolute;
  right: 5px;
  top: 46px;
  padding: 0px;
} */
/* div.van-search__content.van-search__content--square{
  background-color: white;
  border: 1px solid #eee;
} */
/* 搜索按钮 */
/* .searchIcon.van-icon.van-icon-search{
  width: 36px;
  height: 36px;
  background-color: #eee;
  position: absolute;
  right: 5px;
  top: 46px;
  z-index: 10;
  text-align: center;
  line-height: 36px;
} */
</style>